package smetana.domain.raw;

import java.sql.Date;

import com.google.common.base.Preconditions;
import org.apache.pivot.util.CalendarDate;
import smetana.domain.AbstractEntity;
import smetana.util.Pivot;

import static com.google.common.base.Preconditions.checkNotNull;
import static org.apache.commons.lang.StringUtils.defaultString;

public class Doc extends AbstractEntity {
    private int id;
    private Date dateStart;
    private Date dateActual;
    private Date dateEnd;
    private Integer managerId;
    private Integer agentId;
    private String description;
    private String address;
    private String userCode;
    private String contractNote;

    protected Doc() {
        //used by iBatis.
    }

    public Doc(int id) {
        this.id = id;
    }

    @Override
    public int getId() {
        return this.id;
    }

    protected void setId(int id) {
        this.id = id;
    }

    public Date getDateStart() {
        return this.dateStart;
    }

    protected void setDateStart(Date dateStart) {
        this.dateStart = checkNotNull(dateStart);
    }

    public Date getDateActual() {
        return this.dateActual;
    }

    public void setDateActual(Date dateActual) {
        this.dateActual = checkNotNull(dateActual);
    }

    public CalendarDate getDateActualPivot() {
        return Pivot.toCalendarDate(this.dateActual);
    }

    public void setDateActualPivot(CalendarDate dateActual) {
        this.dateActual = Pivot.toDate(checkNotNull(dateActual));

    }

    public Date getDateEnd() {
        return this.dateEnd;
    }

    public void setDateEnd(Date dateEnd) {
        this.dateEnd = checkNotNull(dateEnd);
    }

    public Integer getManagerId() {
        return this.managerId;
    }

    public void setManagerId(Integer managerId) {
        this.managerId = managerId;
    }

    public Integer getAgentId() {
        return this.agentId;
    }

    public void setAgentId(Integer agentId) {
        this.agentId = agentId;
    }

    public String getDescription() {
        return defaultString(this.description);
    }

    public void setDescription(String description) {
        this.description = checkNotNull(description);
    }

    public String getAddress() {
        return defaultString(this.address);
    }

    public void setAddress(String address) {
        this.address = checkNotNull(address);
    }

    public String getUserCode() {
        return defaultString(this.userCode);
    }

    public void setUserCode(String userCode) {
        this.userCode = checkNotNull(userCode);
    }

    public String getContractNote() {
        return defaultString(this.contractNote);
    }

    public void setContractNote(String contractNote) {
        this.contractNote = checkNotNull(contractNote);
    }
}